package com.kuaiditu.assistant.module.retrofit;

import java.io.IOException;

import retrofit2.Converter;


/**
 * Created by Eenie on 2017/7/14.
 * Email: eeniework@gmail.com
 * Des:
 */

public class StringRequestConverter<T> implements Converter<T, String> {
    private ConverterAdapter adapter;
    StringRequestConverter(ConverterAdapter adapter) {
        this.adapter = adapter;
    }


    @Override
    public String convert(T request) throws IOException {
        if (request instanceof String) {
            return request.toString();
        } else {
            return adapter.onConverterRequest(request);
        }


    }
}
